package com.study.lambda.basedemo;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2021/5/29 20:45
 */
public class LambdaDemo02
{
    public static void main(String[] args)
    {
        User user = new User();
        user.setUsername("javaboy");
        String say = user.say((username) -> "hello " + username);
        System.out.println("say = " + say);
    }
}

@FunctionalInterface
interface SayHello
{
    String sayHello(String name);
}

class User
{
    private String username;

    public String getUsername()
    {
        return username;
    }

    public void setUsername(String username)
    {
        this.username = username;
    }

    public String say(SayHello sayHello)
    {
        return sayHello.sayHello(this.username);
    }
}
